/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.service;

import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
import com.github.binarywang.wxpay.exception.WxPayException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
import java.util.SortedMap;

/**
 * 支付服务接口
 * @author joewee
 * @version 1.0.0
 * @Date 2017/11/24 20:30
 */
public interface PayService {

    /**
     * 获取预支付信息
     *
     * @param req
     * @param resp
     * @return
     * @throws ServletException
     * @throws IOException
     */
    Map<String, String> prePay(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException;

    /**
     * 订单查询
     *
     * @param outTradeNo
     * @param transactionId
     * @return
     * @throws ServletException
     * @throws IOException
     */
   Map<String, String> query(String outTradeNo, String transactionId) throws ServletException, IOException;

    /**
     * 退款查询
     *
     * @param req
     * @param resp
     * @return
     * @throws ServletException
     * @throws IOException
     */
    Map<String, String> refundQuery(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException;


    /**
     * 退款
     * @param request
     * @return WxPayRefundResult
     * @throws WxPayException
     */
    Map<String,String>  refund(SortedMap<String, String>  request) throws  IOException;

    /**
     * 通知
     * @param req
     * @param resp
     * @return
     */
    String notify(HttpServletRequest req, HttpServletResponse resp);

}
